package com.rtx.wms.customer.k3.upload;

import javax.annotation.Resource;

import com.alibaba.fastjson.serializer.SerializerFeature;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.rtx.edi.platform.synctask.service.GatWayService;
import com.rtx.wms.customer.k3.api.K3Api;
import com.rtx.wms.customer.k3.upload.asn.K3AsnOrderService;
import com.rtx.wms.customer.k3.upload.so.K3OrderService;

public abstract class K3UploadService {
	
	@Resource(name = "K3ApiGatWayService")
	GatWayService gatWayService;

	protected abstract String resolveCallBackAPICode(Object data);
	
	protected abstract void resolveResonse(String response,Object data);
	
	public void uploadHandle(Object data) {
		
		String method = resolveCallBackAPICode(data);
		
		String sourceJSON = JSON.toJSONString(data, SerializerFeature.WriteDateUseDateFormat);
		
		String result = gatWayService.handel(method, sourceJSON);
		
		resolveResonse(result,data);
	};
}
